package cn.boy.service.impl;

import cn.boy.dao.StudentDao;
import cn.boy.dao.StudentDaoFactory;
import cn.boy.domain.Student;
import cn.boy.service.StudentService;


public class StudentServiceImpl implements StudentService {

	private static StudentDaoFactory instance;
	private static StudentDao dao;
	static{
		instance = StudentDaoFactory.getInstance();
		dao= instance.getStudentDao();
	}

	public void register(Student student){
		dao.add(student);
	}
	
	public void deleteStudent(String no){
		dao.delete(no);
	}
	
	public void updateStudent(Student student){
		dao.update(student);
	}
	
	public void updateStudent(String no,String password){
		dao.update(no, password);
	}
	
	public String queryAllStudent(){
		return dao.queryAll();
	}
	public String queryStudentByDormitoryNO(String dormitoryNO){
		return dao.queryStudentsByDormitoryNO(dormitoryNO);
	}
	
	public String queryStudent(String no){
		return dao.query(no);
	}

	@Override
	public String login(String no, String password) {
		return dao.query(no, password);
	}

	
	
	
}
